<?php

session_start();
include("function-access.php");

$conn = connectSSO();

$sqlOpt = "SELECT * FROM tb_sim WHERE id_sim IN (SELECT id_sim FROM tb_opt)";
$queryOpt = mysqli_query($conn, $sqlOpt);
$barisOpt = mysqli_fetch_array($queryOpt);
$urlDomain = str_replace('http://', '', $barisOpt["url"]);

switch($_GET["act"]){
    case 1 : 
            $_SESSION["ses_idRole"] = $_POST["role"];
            setcookie("c_idrole", base64_encode($_SESSION["ses_idRole"]), time() + 60*60*24*30, "/", ".".$urlDomain);
            break;
    case 2 :
            $_SESSION["ses_sim"] = $_POST["sim"];
            break;
}

?>